'use strict';

const Controller = require('egg').Controller;

class SignInController extends Controller {
  // 打卡
  async input () {
    const { ctx, service } = this
    const payload = ctx.request.body || {}
    const res = await service.signIn.input(payload)
    this.ctx.body = res 
  }

  // 获取打卡信息
  async getSignIn () {
    const { ctx, service } = this
    const params = ctx.query
    console.log('params', params)
    const res = await service.signIn.getSignIn(params)
    ctx.body = res
  }

  // 获取打卡信息
  async getSignInmohu () {
    const { ctx, service } = this
    const params = ctx.query
    console.log('params', params)
    const res = await service.signIn.getSignInmohu(params)
    ctx.body = res
  }

  // 修改信息
  async updateSignIn () {
    const { ctx, service } = this
    const payload = ctx.request.body || {}
    // console.log('payload', payload)
    const res = await service.signIn.updateSignIn(payload)
    this.ctx.body = res
  }

  // 删除
  async deleteSignIn () {
    const { ctx, service } = this
    const payload = ctx.request.body || {}
    // console.log('payload', payload)
    const res = await service.signIn.deleteSignIn(payload)
    this.ctx.body = res
  }

  async redisTest(){
    const name = await this.app.redis.get("name")
    console.log("name",name)
  }
}

module.exports = SignInController;
